#pragma once

template <class T> void SafeRelease(T** ppT)
{
	if (*ppT)
	{
		(*ppT)->Release();
		*ppT = NULL;
	}
}

//-------------------------------------------------------------------
// ShowErrorMessage
//
// Displays an error message.
//-------------------------------------------------------------------

void ShowErrorMessage(PCWSTR format, HRESULT hrErr);
CString GetComExceptionMessage(HRESULT hr);

//-------------------------------------------------------------------
// ChooseDeviceParam struct
//
// Contains an array of IMFActivate pointers. Each pointer represents
// a video capture device. This struct is passed to the dialog where
// the user selects a device.
//-------------------------------------------------------------------

struct ChooseDeviceParam
{
	IMFActivate** ppDevices;
	UINT32      count;
	UINT32      selection;
};